from django import forms
from studenthoods.apps.common import widgets

class ContactForm(forms.Form):
    first_name = forms.CharField(label="First name")
    surname = forms.CharField(label="Surname")
    email = forms.EmailField(label="Email address", widget=widgets.MyEmailInput)
    query = forms.CharField(label="Query", widget=forms.Textarea())
    
    def __init__(self, *args, **kwargs):
        super(ContactForm, self).__init__(*args, **kwargs)

        extra_errors = {
            'first_name':{'required':'Please enter your First name'},
            'surname':{'required':'Please enter your Surname'},
            'email':{'required':'Please enter your Email address'},
            'query':{'required':'Please enter your Query'},
        }

        
        for field, errors in extra_errors.iteritems():
            self.fields[field].error_messages.update(errors)